#include <sstream>
#include "Pizzeria/Tests/Pizza_tests.hpp"
#include "Pizzeria/Pizza.hpp"

namespace pizzeria {

Pizza_tests::Pizza_tests()
    : mTestRunner("Pizza's tests")
{
  mTestRunner.AddTestCase(
      UTESTS_MAKE_CASE_DATA(Pizza_tests::SerializationTests));
  mTestRunner.Run(true);
}

Pizza_tests::~Pizza_tests() {

}

UTESTS_START_TEST(Pizza_tests::SerializationTests) {
  Pizza pizza(Pizza::Americaine, Pizza::XXL);
  Pizza pizza2;

  std::stringstream ss;
  ss << pizza;
  ss >> pizza2;
  UTESTS_FAIL_UNLESS(pizza2.GetSize() == Pizza::XXL
	&& pizza2.GetType() == Pizza::Americaine,
	"(de)serialization failed");
}
UTESTS_END_TEST

} /* namespace pizzeria */
